﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_ROLE_S
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtROLENAME.Text.Trim().Length==0)
			{
				strErr+="ROLENAME不能为空！\\n";	
			}
			if(this.txtREMARK.Text.Trim().Length==0)
			{
				strErr+="REMARK不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtstatus.Text))
			{
				strErr+="status格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtDepth.Text))
			{
				strErr+="Depth格式错误！\\n";	
			}
			if(this.txtPARROLENAME.Text.Trim().Length==0)
			{
				strErr+="PARROLENAME不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtRolekind.Text))
			{
				strErr+="Rolekind格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string ROLENAME=this.txtROLENAME.Text;
			string REMARK=this.txtREMARK.Text;
			int status=int.Parse(this.txtstatus.Text);
			int Depth=int.Parse(this.txtDepth.Text);
			string PARROLENAME=this.txtPARROLENAME.Text;
			int Rolekind=int.Parse(this.txtRolekind.Text);

			GPCSC.Model.CL_ROLE_S model=new GPCSC.Model.CL_ROLE_S();
			model.ROLENAME=ROLENAME;
			model.REMARK=REMARK;
			model.status=status;
			model.Depth=Depth;
			model.PARROLENAME=PARROLENAME;
			model.Rolekind=Rolekind;

			GPCSC.BLL.CL_ROLE_S bll=new GPCSC.BLL.CL_ROLE_S();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
